package com.wechet.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.wechet.common.OrderStatus;
import com.wechet.common.PayStatus;
import com.wechet.domain.OrderDetail;
import com.wechet.utils.Date2Long;
import com.wechet.utils.EnumUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created by sc on 2017/9/21.
 */
@Data
//@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderDto {

    private String orderId;
    private String buyerName;
    private String buyerPhone;
    private String buyerAddress;
    private String BuyerOpenid;
    private BigDecimal orderAmount;
    private Integer orderStatus ;
    private Integer payStatus;

    @JsonSerialize(using = Date2Long.class)
    private Date createTime;
    @JsonSerialize(using = Date2Long.class)
    private Date updateTime;



    private List<OrderDetail> orderDetailList;

    @JsonIgnore
    public OrderStatus getOrderstatusenum() {
        return EnumUtil.getByCode(orderStatus, OrderStatus.class);
    }

    @JsonIgnore
    public PayStatus getPaystatusenum() {
        return EnumUtil.getByCode(payStatus, PayStatus.class);
    }
}
